uid |
---|
NetCode.DependencyInjection.Index |
Dependency Injection is a way to structure applications and to get Services or Helpers in your code.
👉 We suggest you read the introduction to Dependency Injection
Previously this was reserved for internal use. Starting in 2sxc v11.11 all Razor classes have a command called GetService. This is how your code would get a service:
@inherits Custom.Hybrid.Razor14
@Kit.Page.AddOpenGraph("video", "https://2sxc.org/videos/intro.mp4");
👉 Read more about GetService in the docs or in the GetService API.
Just like with with Razor, 2sxc 11.11 added the same GetService to all WebAPIs.
👉
👉
You can get just about anything from 2sxc. The most common services you'll request as of 2sxc 12 are in the ToSic.Sxc.Services namespace.
[!include"history"]